package com.hntest.controller;

import com.hntest.entity.Bid;
import com.hntest.entity.Pager;
import com.hntest.service.BidService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;

/**
 * 投标放贷 控制类
 */
@Controller("BidController")
public class BidController {

    @Autowired
    private BidService bidService;

    public void setBidService(BidService bidService) {
        this.bidService = bidService;
    }

    @RequestMapping(value = "/invest",method = {RequestMethod.GET,RequestMethod.POST})
    public String select(Pager pager, Bid bid, ModelMap modelMap, HttpServletRequest request){
        List<Bid> list = bidService.getListByPage(pager,bid);
        modelMap.put("BidList",list);
        modelMap.put("pager",pager);
        modelMap.put("bid",bid);
        //System.out.println("------>>>"+bid.toString());
       // System.out.println("=======>>>>"+list.get(0));
        return "invest";
    }

    @RequestMapping(value = "/realauthtoUpdate/{bidRequestId}/{amount}")
    public String bidProject(@PathVariable(value = "bidRequestId") int bidRequestId,
                             @PathVariable(value = "amount") BigDecimal amount, ModelMap modelMap){
/*        RealAuth realAuth = realAuthService.getRealAuthById(realauthid);
        System.out.println("---------------->"+realauthid);
        modelMap.put("old",realAuth);*/
        

        return "realauthupdate";
    }

}
